<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//公共接口
Route::match(['get'], 'getCode/{mobile}', 'SmsController@getCode');//短信验证码
Route::match(['post'], 'login', 'Auth\LoginController@login');//登录
Route::post("wechatLogin", "Auth\LoginController@wechatLogin");//微信登录
Route::match(['get'], 'slides', 'SlideController@index');//轮播图列表
Route::match(['get'], 'getCates', 'CommonController@getCates');//获取商品分类

Route::match(['post'], 'getAllArea', 'CommonController@getAllArea');//根据父id获取所有子区域

Route::match(['get'], 'get_sweetness_list', 'CommonController@getSweetnessList');//获取甜度列表


Route::match(['get'], 'getSoftVersion', 'CommonController@getSoftVersion');//获取最新的版本号
Route::match(['get'], 'getCityByTX', 'CommonController@getCityByTX');//获取所在城市
Route::match(['get'], 'getWxOpenId', 'CommonController@getWxOpenId');//获取微信openid
Route::match(['get'], 'getWxInfo', 'CommonController@getWxInfo');//获取微信信息
Route::match(['post'], 'addDevice', 'CommonController@addDevice');//添加设备信息
Route::match(['post'], 'getAppletOpenId', 'CommonController@getAppletOpenId');//获取小程序openid


Route::match(['get', 'post'], 'notify_url_shop', 'PaymentController@wxNotifyShop');//微信支付回调
Route::match(['get', 'post'], 'notify_url_recharge', 'PaymentController@wxNotifyRecharge');
Route::match(['get', 'post'], 'alipay_notify_shop', 'PaymentController@alipayNotifyShop');//支付宝支付回调
Route::match(['get', 'post'], 'getAgreement', 'CommonController@getAgreement');//获取协议内容

//无须登录的接口
Route::group(['namespace' => 'Home'], function () {
    Route::match(['get'], '/', 'IndexController@index');
    Route::match(['get', 'post'], 'common/allPositions', 'CommonController@allPositions');//获取二级职位json例表
    Route::match(['get', 'post'], 'common/secondposition/{pid}', 'CommonController@secondPosition');//获取二级职位json例表
    Route::match(['get', 'post'], 'allsearch', 'CommonController@allSearch');

    Route::match(['get', 'post'], 'search_result', 'ProductController@searchResult');
    Route::post("checkCode", "CommonController@checkCode");//验证短信验证码
    Route::post("upload", "CommonController@uploadImg");//上传图片

    Route::post("banklist", "IndexController@banklist");//可用的银行列表

    Route::match(['get'], 'getSelectedProduts', 'ProductController@getSelectedProduts');//首页热销或新品
    Route::match(['get', 'post'], 'getProdutsByField', 'ProductController@getProdutsByField');//首页名品，名酒，名家
    Route::match(['get'], 'getAllAttrs', 'ProductController@getAllAttrs');//获取产品的所有规格
    Route::post("productList", "ProductController@index");
    Route::match(['get'], 'getCatesProduts', 'ProductController@getCatesProduts');//获取分类下的产品
    Route::match(['get'], 'getProdutsByKeyword', 'ProductController@getProdutsByKeyword');//根据关键字获取商品
    Route::get("detail", "ProductController@detail");//获取商品详情
    Route::match(['get'], 'getRecommedProduts', 'ProductController@getRecommedProduts');//获取推荐商品

    Route::post('register', 'UserController@register');//个人注册
    Route::post('reset_pwd', 'UserController@resetPwd');//重置登录密码

    Route::post('business_add', 'BusinessController@create');//添加商户
    Route::get('business_lists', 'BusinessController@index');//商户列表
    Route::get('business_detail', 'BusinessController@read');//商户详情

    Route::get('stamps_lists', 'StampsController@index');//邮票列表
    Route::get('stamps_detail', 'StampsController@read');//邮票详情
});

//登录后的信息
Route::group(['middleware' => 'api.auth', 'namespace' => 'Home'], function () {
    Route::match(['post'], 'common/addDevice', 'CommonController@addDevice');//添加设备信息
    Route::post('getUserInfo', 'UserController@index');//登录
    Route::post('getComInfo', 'CompanyController@index');

    Route::post("headimg", "UserController@changeHeadimg");//更新头像
    Route::post("realname", "UserController@changeRealname");//更新姓名
    Route::post("sex", "UserController@changeSex");//更新性别
    Route::post("experience", "UserController@changeWork");//更新性别
    Route::post("mobile", "UserController@changeMobile");//更新手机号码
    Route::post("introduce", "UserController@changeIntroduce");//更新手机号码
    Route::post("borth", "UserController@changeBorth");//更新出生日期
    Route::post("jobarea", "UserController@changeJobarea");//更新工作地点
    Route::post("jobsort", "UserController@changeJobsort");//更新工种
    Route::post("updateMemberMsg", "UserController@updateMemberMsg");//更新昵称和姓名
    Route::post("id1", "UserController@changeid1");//更新身份证正面照
    Route::post("ID2", "UserController@changeID2");//更新身份证反面照
    Route::post("authReply", "UserController@authReply");//认证申请
    Route::post("suggesting", "UserController@suggesting");//用户反馈
    Route::post("deleteAccount", "UserController@deleteAccount");//删除我的账号

    Route::post("addOpinion", "IndexController@addOpinion");//意见反馈

    Route::post("checkPwd2", "IndexController@checkPwd2");//验证支付密码
    Route::post("checkPsd2", "IndexController@checkPsd2");//验证支付密码
    Route::post("changePwd2", "IndexController@changePwd2");//更新支付密码
    Route::post("changePwd1", "IndexController@changePwd1");//更新登录密码

    Route::get("isCollect", "ProductController@isCollect");//是否收藏商品
    Route::post("changeCollect", "ProductController@changeCollect");//收藏/删除商品
    Route::post("shopCollect", "ProductController@shopCollect");//我的收藏商品
    Route::post("delCollect", "ProductController@delCollect");//删除收藏

    Route::post("addCart", "ProductController@addCart");//添加商品进购物车
    Route::post("delCart", "ProductController@delCart");//删除购物车商品
    Route::post("cartList", "ProductController@cartList");//我的购物车
    Route::post("clearCart", "ProductController@clearCart");//清空购物车
    Route::post("order", "ProductController@order");//去结算
    Route::post("createOrder", "ProductController@createOrder");//生成订单

    Route::post("getOrder", "ProductController@getOrder");//获取商品清单
    Route::post("goOrder", "ProductController@goOrder");//再次去支付
    Route::post("payAgain", "ProductController@payAgain");//去付款
    Route::post("goPay", "ProductController@goPay");//支付订单

    Route::post("addShopBrowser", "ProductController@addShopBrowser");//添加商品浏览记录
    Route::post("shopBrowser", "ProductController@shopBrowser");//我的浏览商品
    Route::post("delBrowser", "ProductController@delBrowser");//我的浏览商品

    Route::post("getAddress", "ProductController@getDefaultAddress");//获取默认收货地址
    Route::post("getAddressInfo", "ProductController@addressInfo");//获取地址详情
    Route::post("editAddress", "ProductController@editAddress");//添加或编辑地址
    Route::post("getAllAddress", "ProductController@getAllAddress");//获取收货地址

    Route::post("orders", "ProductController@orders");//订单列表
    Route::post("delOrder", "ProductController@delOrder");//删除订单
    Route::post("canOrder", "ProductController@cancleOrder");//取消订单
    Route::post("conOrder", "ProductController@confirmOrder");//确认订单

    Route::post("add_invoice", "InvoiceController@addInvoice");//添加发票
    Route::post("del_invoice", "InvoiceController@delInvoice");//删除发票

    Route::post("video_count", "VideosController@videoCount");//个人视频统计
    Route::post("add_video", "VideosController@addVideo");//添加视频资源
    Route::post("video_list", "VideosController@videoList");//视频资源列表
    Route::post("other_video_list", "VideosController@otherVideoList");//视频资源列表
    Route::post("add_attention", "VideosController@addAttention");//添加关注
    Route::post("del_attention", "VideosController@delAttention");//取消关注
    Route::post("add_praise", "VideosController@addPraise");//添加点赞
    Route::post("add_collect", "VideosController@addCollect");//添加收藏
    Route::post("add_broswer", "VideosController@addBroswer");//添加浏览
    Route::post("my_vedios", "VideosController@myVedios");//我的视频列表
    Route::post("my_praise_vedios", "VideosController@myPraiseVedios");//我的点赞视频
    Route::post("my_collect_vedios", "VideosController@myCollectVedios");//我的收藏视频
    Route::post("del_my_vedio", "VideosController@delMyVedio");//删除我的视频
    Route::post("my_attentions", "VideosController@myAttentions");//我的粉丝
    Route::post("my_attention", "VideosController@myAttention");//我的关注
    Route::post("add_report", "VideosController@addReport");//视频举报


});

Route::match(['get', 'post'], 'add_address', 'ShippingAddress1Controller@add');
